package com.huike.clues.service.impl;


import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

/**
 * 线索跟进记录Service业务层处理
 * @date 2022-04-22
 */
@Service
public class TbClueTrackRecordServiceImpl implements ITbClueTrackRecordService {

    @Autowired
    private TbClueTrackRecordMapper tbClueTrackRecordMapper;
    /**
     * 存放线索跟进记录
     * @param tbClueTrackRecord
     * @return
     */
    @Override
    public boolean addTrackRecord(ClueTrackRecordVo tbClueTrackRecord) {
        String username = SecurityUtils.getUsername();
//        Timestamp timestamp = new Timestamp(tbClueTrackRecord.getNextTime().getTime());
//        tbClueTrackRecord.setNextTime(timestamp);
        boolean b = tbClueTrackRecordMapper.addTrackRecord(tbClueTrackRecord,username);
        return b;
    }

    @Override
    public List<TbClueTrackRecord> getAllRecordBiId(Long clueId) {
        List<TbClueTrackRecord> allRecordBiId = tbClueTrackRecordMapper.getAllRecordBiId(clueId);
        return allRecordBiId;
    }

    /**
     * 查询fasle——reson对应的中文
     * @param reason
     * @return
     */
    @Override
    public String getFalseReason(String reason) {
       return tbClueTrackRecordMapper.getFalseReason(reason);
    }
}
